package cn.edu.neusoft.wuguangsheng.flowerimpression.activity;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import cn.edu.neusoft.wuguangsheng.flowerimpression.R;

public abstract class BaseActivity extends AppCompatActivity {
    protected int layout_file= R.layout.activity_main;
    abstract void initView();
    abstract void initEvent();
    abstract void initDate();

    void setLayout_file(int layout_file){
        setContentView(layout_file);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
        initDate();
        initEvent();
    }

    public String getuser() {
        SharedPreferences sp;
        sp = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("userphone", "");
    }

    public String getpass() {
        SharedPreferences sp;
        sp = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("password", "");
    }

    public String getid() {
        SharedPreferences sp;
        sp = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("userid", "");
    }

    public String getphone() {
        SharedPreferences sp;
        sp = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("phone", "");
    }
    public String getemail() {
        SharedPreferences sp;
        sp = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("email", "");
    }

    public Boolean getUer_remember() {
        SharedPreferences sp;
        sp = getSharedPreferences(
                "userInfo", MODE_PRIVATE);
        return sp.getBoolean("remember", false);
    }


}
